package com.zyh.controller;

import com.zyh.pojo.Books;
import com.zyh.pojo.Zjywpt_yg_trand_infos;
import com.zyh.service.SelectTradeBillsServiceImpl;
import com.zyh.service.TrandServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.UUID;

/**
 * @author shihan
 * @date 2020-12-02-17:55
 */
@Controller
@RequestMapping("/trand")
public class TrandController {

    @Autowired
    @Qualifier("TrandServiceImpl")
    private TrandServiceImpl trandServicebill;



    @RequestMapping("/addTrand")
    public String addPaper(Model model,Zjywpt_yg_trand_infos zjywpt_yg_trand_infos) {
        System.out.println(zjywpt_yg_trand_infos);
        String id = UUID.randomUUID().toString();
        zjywpt_yg_trand_infos.setID(id);

        System.out.println(id);
        zjywpt_yg_trand_infos.setESBSTATUS("1");
       // zjywpt_yg_trand_infos.setMSG("hello");
        zjywpt_yg_trand_infos.setRECDATE("jkl");
        zjywpt_yg_trand_infos.setREMARK("fsdf");
        zjywpt_yg_trand_infos.setSTATUS("1");
        zjywpt_yg_trand_infos.setRETDATE("20200908");
        this.trandServicebill.addTrand(zjywpt_yg_trand_infos);


        return "allTrand";
    }



    @RequestMapping("/updateBTrand")
    public String updateTrand(Model model, Zjywpt_yg_trand_infos zjywpt_yg_trand_infos) {
        System.out.println(zjywpt_yg_trand_infos);


        zjywpt_yg_trand_infos.setID("4b034c40-1935-41e0-aea0-7ce0e8b88e6b");

        //zjywpt_yg_trand_infos.setMSG("hello");
        zjywpt_yg_trand_infos.setRETDATE("20200908");
        zjywpt_yg_trand_infos.setSTATUS("2");
        zjywpt_yg_trand_infos.setREMARK("fsdf");
        zjywpt_yg_trand_infos.setESBSTATUS("1");
        zjywpt_yg_trand_infos.setRECDATE("jkl");
        this.trandServicebill.updateBTrand(zjywpt_yg_trand_infos);
        //Zjywpt_yg_trand_infos zjywpt_yg_trand_info = this.trandServicebill.queryBookById(zjywpt_yg_trand_infos.getID());
       // model.addAttribute("books", zjywpt_yg_trand_info);
        return "redirect:/allTrand";
    }


}
